
<!DOCTYPE html>
<html lang="en" class="loading">
<head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
    <meta name="viewport" content="width=device-width, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <title>14.综合应用 —— 名片管理系统 - fubaisen</title>
    <meta name="apple-mobile-web-app-capable" content="yes" />
    <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
    <meta name="google" content="notranslate" />
    <meta name="keywords" content="Fechin,"> 
    <meta name="description" content="综合应用 —— 名片管理系统目标综合应用已经学习过的知识点：

变量
流程控制
函数
模块

开发 名片管理系统
系统需求

程序启动，显示名片管理系统欢迎界面，并显示功能菜单



1234567,"> 
    <meta name="author" content="John Doe"> 
    <link rel="alternative" href="atom.xml" title="fubaisen" type="application/atom+xml"> 
    <link rel="icon" href="/img/favicon.png"> 
    
    
    
    <meta name="twitter:card" content="summary"/>
    <meta name="twitter:title" content="14.综合应用 —— 名片管理系统 - fubaisen"/>
    <meta name="twitter:description" content="综合应用 —— 名片管理系统目标综合应用已经学习过的知识点：

变量
流程控制
函数
模块

开发 名片管理系统
系统需求

程序启动，显示名片管理系统欢迎界面，并显示功能菜单



1234567,"/>
    
    
    
    
    <meta property="og:site_name" content="fubaisen"/>
    <meta property="og:type" content="object"/>
    <meta property="og:title" content="14.综合应用 —— 名片管理系统 - fubaisen"/>
    <meta property="og:description" content="综合应用 —— 名片管理系统目标综合应用已经学习过的知识点：

变量
流程控制
函数
模块

开发 名片管理系统
系统需求

程序启动，显示名片管理系统欢迎界面，并显示功能菜单



1234567,"/>
    
<link rel="stylesheet" href="/css/diaspora.css">

    <script>window.searchDbPath = "/search.xml";</script>
    <link rel="preconnect" href="https://fonts.googleapis.com">
    <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
    <link href="https://fonts.googleapis.com/css2?family=Source+Code+Pro&display=swap" rel="stylesheet">
<meta name="generator" content="Hexo 6.3.0"></head>

<body class="loading">
    <span id="config-title" style="display:none">fubaisen</span>
    <div id="loader"></div>
    <div id="single">
    <div id="top" style="display: block;">
    <div class="bar" style="width: 0;"></div>
    <a class="iconfont icon-home image-icon" href="javascript:;" data-url="http://fubaisen.github.io"></a>
    <div title="播放/暂停" class="iconfont icon-play"></div>
    <h3 class="subtitle">14.综合应用 —— 名片管理系统</h3>
    <div class="social">
        <div>
            <div class="share">
                <a title="获取二维码" class="iconfont icon-scan" href="javascript:;"></a>
            </div>
            <div id="qr"></div>
        </div>
    </div>
    <div class="scrollbar"></div>
</div>

    <div class="section">
        <div class="article">
    <div class='main'>
        <h1 class="title">14.综合应用 —— 名片管理系统</h1>
        <div class="stuff">
            <span>一月 19, 2022</span>
            
  <ul class="post-tags-list" itemprop="keywords"><li class="post-tags-list-item"><a class="post-tags-list-link" href="/tags/python%E5%AD%A6%E4%B9%A0/" rel="tag">python学习</a></li></ul>


        </div>
        <div class="content markdown">
            <h1 id="综合应用-——-名片管理系统"><a href="#综合应用-——-名片管理系统" class="headerlink" title="综合应用 —— 名片管理系统"></a>综合应用 —— 名片管理系统</h1><h2 id="目标"><a href="#目标" class="headerlink" title="目标"></a>目标</h2><p>综合应用已经学习过的知识点：</p>
<ul>
<li><strong>变量</strong></li>
<li><strong>流程控制</strong></li>
<li><strong>函数</strong></li>
<li><strong>模块</strong></li>
</ul>
<p>开发 <strong>名片管理系统</strong></p>
<h2 id="系统需求"><a href="#系统需求" class="headerlink" title="系统需求"></a>系统需求</h2><ul>
<li><ol>
<li>程序启动，显示名片管理系统欢迎界面，并显示功能菜单</li>
</ol>
</li>
</ul>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line">**************************************************</span><br><span class="line">欢迎使用【名片管理系统】V1.0</span><br><span class="line"></span><br><span class="line">1. 新建名片</span><br><span class="line">2. 显示全部</span><br><span class="line">3. 查询名片</span><br><span class="line"></span><br><span class="line">0. 退出系统</span><br><span class="line">**************************************************</span><br></pre></td></tr></table></figure>

<ul>
<li><ol start="2">
<li>用户用数字选择不同的功能</li>
</ol>
</li>
<li><ol start="3">
<li>根据功能选择，执行不同的功能</li>
</ol>
</li>
<li><ol start="4">
<li>用户名片需要记录用户的 <strong>姓名</strong>、<strong>电话</strong>、<strong>QQ</strong>、<strong>邮件</strong></li>
</ol>
</li>
<li><ol start="5">
<li>如果查询到指定的名片，用户可以选择 <strong>修改</strong> 或者 <strong>删除</strong> 名片</li>
</ol>
</li>
</ul>
<h2 id="步骤"><a href="#步骤" class="headerlink" title="步骤"></a>步骤</h2><ol>
<li>框架搭建</li>
<li>新增名片</li>
<li>显示所有名片</li>
<li>查询名片</li>
<li>查询成功后修改、删除名片</li>
<li>让 Python 程序能够直接运行</li>
</ol>
<h2 id="01-框架搭建"><a href="#01-框架搭建" class="headerlink" title="01. 框架搭建"></a>01. 框架搭建</h2><p><strong>目标</strong></p>
<ul>
<li>搭建名片管理系统 <strong>框架结构</strong><ol>
<li><strong>准备文件</strong>，确定文件名，保证能够 <strong>在需要的位置</strong> 编写代码</li>
<li>编写 <strong>主运行循环</strong>，实现基本的 <strong>用户输入和判断</strong></li>
</ol>
</li>
</ul>
<h3 id="1-1-文件准备"><a href="#1-1-文件准备" class="headerlink" title="1.1 文件准备"></a>1.1 文件准备</h3><ol>
<li>新建 <code>cards_main.py</code> 保存 <strong>主程序功能代码</strong><ul>
<li>程序的入口</li>
<li>每一次启动名片管理系统都通过 <code>main</code> 这个文件启动</li>
</ul>
</li>
<li>新建 <code>cards_tools.py</code> 保存 <strong>所有名片功能函数</strong><ul>
<li>将对名片的 <strong>新增</strong>、<strong>查询</strong>、<strong>修改</strong>、<strong>删除</strong> 等功能封装在不同的函数中</li>
</ul>
</li>
</ol>
<h3 id="1-2-编写主运行循环"><a href="#1-2-编写主运行循环" class="headerlink" title="1.2 编写主运行循环"></a>1.2 编写主运行循环</h3><ul>
<li>在 <code>cards_main</code> 中添加一个 <strong>无限循环</strong></li>
</ul>
<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br></pre></td><td class="code"><pre><span class="line"></span><br><span class="line"><span class="keyword">while</span> <span class="literal">True</span>:</span><br><span class="line"></span><br><span class="line">    <span class="comment"># TODO(小明) 显示系统菜单</span></span><br><span class="line"></span><br><span class="line">    action = <span class="built_in">input</span>(<span class="string">&quot;请选择操作功能：&quot;</span>)</span><br><span class="line"></span><br><span class="line">    <span class="built_in">print</span>(<span class="string">&quot;您选择的操作是：%s&quot;</span> % action)</span><br><span class="line"></span><br><span class="line">    <span class="comment"># 根据用户输入决定后续的操作</span></span><br><span class="line">    <span class="keyword">if</span> action <span class="keyword">in</span> [<span class="string">&quot;1&quot;</span>, <span class="string">&quot;2&quot;</span>, <span class="string">&quot;3&quot;</span>]:</span><br><span class="line">        <span class="keyword">pass</span></span><br><span class="line">    <span class="keyword">elif</span> action == <span class="string">&quot;0&quot;</span>:</span><br><span class="line">        <span class="built_in">print</span>(<span class="string">&quot;欢迎再次使用【名片管理系统】&quot;</span>)</span><br><span class="line"></span><br><span class="line">        <span class="keyword">break</span></span><br><span class="line">    <span class="keyword">else</span>:</span><br><span class="line">        <span class="built_in">print</span>(<span class="string">&quot;输入错误，请重新输入&quot;</span>)</span><br><span class="line"></span><br></pre></td></tr></table></figure>

<h4 id="字符串判断"><a href="#字符串判断" class="headerlink" title="字符串判断"></a>字符串判断</h4><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">if</span> action <span class="keyword">in</span> [<span class="string">&quot;1&quot;</span>, <span class="string">&quot;2&quot;</span>, <span class="string">&quot;3&quot;</span>]:     <span class="comment"># 成员运算符</span></span><br></pre></td></tr></table></figure>

<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">if</span> action == <span class="string">&quot;1&quot;</span> <span class="keyword">or</span> action == <span class="string">&quot;2&quot;</span> <span class="keyword">or</span> action == <span class="string">&quot;3&quot;</span>:</span><br></pre></td></tr></table></figure>

<ol>
<li><p>使用 <code>in</code> 针对 <strong>列表</strong> 判断，避免使用 <code>or</code> 拼接复杂的逻辑条件</p>
<p><img src="https://s2.loli.net/2022/01/16/jm1t3BW6Ff7Zo9M.png" alt="image-20220116141725432"></p>
</li>
<li><p>没有使用 <code>int</code> 转换用户输入，可以避免 <strong>一旦用户输入的不是数字</strong>，导致程序运行出错</p>
</li>
</ol>
<h4 id="pass"><a href="#pass" class="headerlink" title="pass"></a>pass</h4><ul>
<li><p>是为了保持程序结构的完整性</p>
</li>
<li><p>&#96;&#96;&#96;</p>
<h1 id="如果在开发程序时，不希望立刻编写分支内部的代码"><a href="#如果在开发程序时，不希望立刻编写分支内部的代码" class="headerlink" title="如果在开发程序时，不希望立刻编写分支内部的代码"></a>如果在开发程序时，不希望立刻编写分支内部的代码</h1><h1 id="可以使用-pass-关键字，表示一个占位符，能够保证程序的代码结构正确！"><a href="#可以使用-pass-关键字，表示一个占位符，能够保证程序的代码结构正确！" class="headerlink" title="可以使用 pass 关键字，表示一个占位符，能够保证程序的代码结构正确！"></a>可以使用 pass 关键字，表示一个占位符，能够保证程序的代码结构正确！</h1><h1 id="程序运行时，pass-关键字不会执行任何的操作！"><a href="#程序运行时，pass-关键字不会执行任何的操作！" class="headerlink" title="程序运行时，pass 关键字不会执行任何的操作！"></a>程序运行时，pass 关键字不会执行任何的操作！</h1><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br></pre></td><td class="code"><pre><span class="line"></span><br><span class="line">#### 无限循环</span><br><span class="line"></span><br><span class="line">* 在开发软件时，如果 **不希望程序执行后** 立即退出</span><br><span class="line">* 可以在程序中增加一个 **无限循环**</span><br><span class="line">* **由用户来决定** 退出程序的时机</span><br><span class="line"></span><br><span class="line">#### TODO 注释</span><br><span class="line"></span><br><span class="line">* 在 `#` 后跟上 `TODO`，用于标记需要去做的工作</span><br><span class="line"></span><br><span class="line">```python</span><br><span class="line"># TODO(作者/邮件) 显示系统菜单</span><br></pre></td></tr></table></figure></li>
</ul>
<h3 id="1-3-在-cards-tools-中增加四个新函数"><a href="#1-3-在-cards-tools-中增加四个新函数" class="headerlink" title="1.3 在 cards_tools 中增加四个新函数"></a>1.3 在 <code>cards_tools</code> 中增加四个新函数</h3><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">def</span> <span class="title function_">show_menu</span>():</span><br><span class="line"></span><br><span class="line">    <span class="string">&quot;&quot;&quot;显示菜单</span></span><br><span class="line"><span class="string">    &quot;&quot;&quot;</span></span><br><span class="line">    <span class="keyword">pass</span></span><br><span class="line"></span><br><span class="line"><span class="keyword">def</span> <span class="title function_">new_card</span>():</span><br><span class="line"></span><br><span class="line">    <span class="string">&quot;&quot;&quot;新建名片</span></span><br><span class="line"><span class="string">    &quot;&quot;&quot;</span></span><br><span class="line">    <span class="built_in">print</span>(<span class="string">&quot;-&quot;</span> * <span class="number">50</span>)</span><br><span class="line">    <span class="built_in">print</span>(<span class="string">&quot;功能：新建名片&quot;</span>)</span><br><span class="line"></span><br><span class="line"></span><br><span class="line"><span class="keyword">def</span> <span class="title function_">show_all</span>():</span><br><span class="line"></span><br><span class="line">    <span class="string">&quot;&quot;&quot;显示全部</span></span><br><span class="line"><span class="string">    &quot;&quot;&quot;</span></span><br><span class="line">    <span class="built_in">print</span>(<span class="string">&quot;-&quot;</span> * <span class="number">50</span>)</span><br><span class="line">    <span class="built_in">print</span>(<span class="string">&quot;功能：显示全部&quot;</span>)</span><br><span class="line"></span><br><span class="line"></span><br><span class="line"><span class="keyword">def</span> <span class="title function_">search_card</span>():</span><br><span class="line"></span><br><span class="line">    <span class="string">&quot;&quot;&quot;搜索名片</span></span><br><span class="line"><span class="string">    &quot;&quot;&quot;</span></span><br><span class="line">    <span class="built_in">print</span>(<span class="string">&quot;-&quot;</span> * <span class="number">50</span>)</span><br><span class="line">    <span class="built_in">print</span>(<span class="string">&quot;功能：搜索名片&quot;</span>)</span><br><span class="line"></span><br></pre></td></tr></table></figure>

<h3 id="1-4-导入模块"><a href="#1-4-导入模块" class="headerlink" title="1.4 导入模块"></a>1.4 导入模块</h3><ul>
<li>在 <code>cards_main.py</code> 中使用 <code>import</code> 导入 <code>cards_tools</code> 模块</li>
</ul>
<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">import</span> cards_tools</span><br></pre></td></tr></table></figure>

<ul>
<li>修改 <code>while</code> 循环的代码如下：</li>
</ul>
<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">import</span> cards_tools</span><br><span class="line"></span><br><span class="line"><span class="keyword">while</span> <span class="literal">True</span>:</span><br><span class="line"></span><br><span class="line">    cards_tools.show_menu()</span><br><span class="line"></span><br><span class="line">    action = <span class="built_in">input</span>(<span class="string">&quot;请选择操作功能：&quot;</span>)</span><br><span class="line"></span><br><span class="line">    <span class="built_in">print</span>(<span class="string">&quot;您选择的操作是：%s&quot;</span> % action)</span><br><span class="line"></span><br><span class="line">    <span class="comment"># 根据用户输入决定后续的操作</span></span><br><span class="line">    <span class="keyword">if</span> action <span class="keyword">in</span> [<span class="string">&quot;1&quot;</span>, <span class="string">&quot;2&quot;</span>, <span class="string">&quot;3&quot;</span>]:</span><br><span class="line"></span><br><span class="line">        <span class="keyword">if</span> action == <span class="string">&quot;1&quot;</span>:</span><br><span class="line">            cards_tools.new_card()</span><br><span class="line"></span><br><span class="line">        <span class="keyword">elif</span> action == <span class="string">&quot;2&quot;</span>:</span><br><span class="line">            cards_tools.show_all()</span><br><span class="line"></span><br><span class="line">        <span class="keyword">elif</span> action == <span class="string">&quot;3&quot;</span>:</span><br><span class="line">            cards_tools.search_card()</span><br><span class="line"></span><br><span class="line">    <span class="keyword">elif</span> action == <span class="string">&quot;0&quot;</span>:</span><br><span class="line">        <span class="built_in">print</span>(<span class="string">&quot;欢迎再次使用【名片管理系统】&quot;</span>)</span><br><span class="line"></span><br><span class="line">        <span class="keyword">break</span></span><br><span class="line">    <span class="keyword">else</span>:</span><br><span class="line">        <span class="built_in">print</span>(<span class="string">&quot;输入错误，请重新输入：&quot;</span>)</span><br><span class="line"></span><br></pre></td></tr></table></figure>

<blockquote>
<p>至此：<code>cards_main</code> 中的所有代码全部开发完毕！</p>
</blockquote>
<h3 id="1-5-完成-show-menu-函数"><a href="#1-5-完成-show-menu-函数" class="headerlink" title="1.5 完成 show_menu 函数"></a>1.5 完成 <code>show_menu</code> 函数</h3><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">def</span> <span class="title function_">show_menu</span>():</span><br><span class="line"></span><br><span class="line">    <span class="string">&quot;&quot;&quot;显示菜单</span></span><br><span class="line"><span class="string">    &quot;&quot;&quot;</span></span><br><span class="line">    <span class="built_in">print</span>(<span class="string">&quot;*&quot;</span> * <span class="number">50</span>)</span><br><span class="line">    <span class="built_in">print</span>(<span class="string">&quot;欢迎使用【菜单管理系统】V1.0&quot;</span>)</span><br><span class="line">    <span class="built_in">print</span>(<span class="string">&quot;&quot;</span>)</span><br><span class="line">    <span class="built_in">print</span>(<span class="string">&quot;1. 新建名片&quot;</span>)</span><br><span class="line">    <span class="built_in">print</span>(<span class="string">&quot;2. 显示全部&quot;</span>)</span><br><span class="line">    <span class="built_in">print</span>(<span class="string">&quot;3. 查询名片&quot;</span>)</span><br><span class="line">    <span class="built_in">print</span>(<span class="string">&quot;&quot;</span>)</span><br><span class="line">    <span class="built_in">print</span>(<span class="string">&quot;0. 退出系统&quot;</span>)</span><br><span class="line">    <span class="built_in">print</span>(<span class="string">&quot;*&quot;</span> * <span class="number">50</span>)</span><br><span class="line"></span><br></pre></td></tr></table></figure>

<h2 id="02-保存名片数据的结构"><a href="#02-保存名片数据的结构" class="headerlink" title="02. 保存名片数据的结构"></a>02. 保存名片数据的结构</h2><p><strong>程序就是用来处理数据的，而变量就是用来存储数据的</strong></p>
<ul>
<li>使用 <strong>字典</strong> 记录 <strong>每一张名片</strong> 的详细信息</li>
<li>使用 <strong>列表</strong> 统一记录所有的 <strong>名片字典</strong></li>
</ul>
<p><img src="https://s2.loli.net/2022/01/11/rjRLh6AVOHifevk.png" alt="001_名片管理系统全局列表-w500"></p>
<h3 id="定义名片列表变量"><a href="#定义名片列表变量" class="headerlink" title="定义名片列表变量"></a>定义名片列表变量</h3><ul>
<li>在 <code>cards_tools</code> 文件的顶部增加一个 <strong>列表变量</strong></li>
</ul>
<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># 所有名片记录的列表</span></span><br><span class="line">card_list = []</span><br></pre></td></tr></table></figure>

<p><strong>注意</strong></p>
<ol>
<li><strong>所有名片相关操作</strong>，都需要使用这个列表，所以应该 <strong>定义在程序的顶部</strong></li>
<li><strong>程序刚运行时，没有数据</strong>，所以是 <strong>空列表</strong></li>
</ol>
<h2 id="03-新增名片"><a href="#03-新增名片" class="headerlink" title="03. 新增名片"></a>03. 新增名片</h2><h3 id="3-1-功能分析"><a href="#3-1-功能分析" class="headerlink" title="3.1 功能分析"></a>3.1 功能分析</h3><ol>
<li>提示用户依次输入名片信息</li>
<li>将名片信息保存到一个字典</li>
<li>将字典添加到名片列表</li>
<li>提示名片添加完成</li>
</ol>
<h3 id="3-2-实现-new-card-方法"><a href="#3-2-实现-new-card-方法" class="headerlink" title="3.2 实现 new_card 方法"></a>3.2 实现 new_card 方法</h3><ul>
<li>根据步骤实现代码</li>
</ul>
<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">def</span> <span class="title function_">new_card</span>():</span><br><span class="line"></span><br><span class="line">    <span class="string">&quot;&quot;&quot;新建名片</span></span><br><span class="line"><span class="string">    &quot;&quot;&quot;</span></span><br><span class="line">    <span class="built_in">print</span>(<span class="string">&quot;-&quot;</span> * <span class="number">50</span>)</span><br><span class="line">    <span class="built_in">print</span>(<span class="string">&quot;功能：新建名片&quot;</span>)</span><br><span class="line"></span><br><span class="line">    <span class="comment"># 1. 提示用户输入名片信息</span></span><br><span class="line">    name = <span class="built_in">input</span>(<span class="string">&quot;请输入姓名：&quot;</span>)</span><br><span class="line">    phone = <span class="built_in">input</span>(<span class="string">&quot;请输入电话：&quot;</span>)</span><br><span class="line">    qq = <span class="built_in">input</span>(<span class="string">&quot;请输入 QQ 号码：&quot;</span>)</span><br><span class="line">    email = <span class="built_in">input</span>(<span class="string">&quot;请输入邮箱：&quot;</span>)</span><br><span class="line"></span><br><span class="line">    <span class="comment"># 2. 将用户信息保存到一个字典</span></span><br><span class="line">    card_dict = &#123;<span class="string">&quot;name&quot;</span>: name,</span><br><span class="line">                 <span class="string">&quot;phone&quot;</span>: phone,</span><br><span class="line">                 <span class="string">&quot;qq&quot;</span>: qq,</span><br><span class="line">                 <span class="string">&quot;email&quot;</span>: email&#125;</span><br><span class="line"></span><br><span class="line">    <span class="comment"># 3. 将用户字典添加到名片列表</span></span><br><span class="line">    card_list.append(card_dict)</span><br><span class="line"></span><br><span class="line">    <span class="built_in">print</span>(card_list)</span><br><span class="line">    </span><br><span class="line">    <span class="comment"># 4. 提示添加成功信息</span></span><br><span class="line">    <span class="built_in">print</span>(<span class="string">&quot;成功添加 %s 的名片&quot;</span> % card_dict[<span class="string">&quot;name&quot;</span>])</span><br><span class="line"></span><br></pre></td></tr></table></figure>

<blockquote>
<h1 id="技巧：在-PyCharm-中，可以使用-SHIFT-F6-统一修改变量名"><a href="#技巧：在-PyCharm-中，可以使用-SHIFT-F6-统一修改变量名" class="headerlink" title="技巧：在 PyCharm 中，可以使用 SHIFT + F6 统一修改变量名"></a>技巧：在 <code>PyCharm</code> 中，可以使用 <code>SHIFT + F6</code> 统一修改变量名<img src="https://s2.loli.net/2022/01/17/rIlCog3X2U5ueFn.png" alt="image-20220117153300537"></h1></blockquote>
<h2 id="04-显示所有名片"><a href="#04-显示所有名片" class="headerlink" title="04. 显示所有名片"></a>04. 显示所有名片</h2><h3 id="4-1-功能分析"><a href="#4-1-功能分析" class="headerlink" title="4.1 功能分析"></a>4.1 功能分析</h3><ul>
<li>循环遍历名片列表，顺序显示每一个字典的信息</li>
</ul>
<h3 id="4-2-基础代码实现"><a href="#4-2-基础代码实现" class="headerlink" title="4.2 基础代码实现"></a>4.2 基础代码实现</h3><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">def</span> <span class="title function_">show_all</span>():</span><br><span class="line"></span><br><span class="line">    <span class="string">&quot;&quot;&quot;显示全部</span></span><br><span class="line"><span class="string">    &quot;&quot;&quot;</span></span><br><span class="line">    <span class="built_in">print</span>(<span class="string">&quot;-&quot;</span> * <span class="number">50</span>)</span><br><span class="line">    <span class="built_in">print</span>(<span class="string">&quot;功能：显示全部&quot;</span>)</span><br><span class="line"></span><br><span class="line">    <span class="keyword">for</span> card_dict <span class="keyword">in</span> card_list:</span><br><span class="line"></span><br><span class="line">        <span class="built_in">print</span>(card_dict)</span><br><span class="line">        </span><br></pre></td></tr></table></figure>

<ul>
<li>显示效果不好！</li>
</ul>
<h3 id="4-3-增加标题和使用-t-显示"><a href="#4-3-增加标题和使用-t-显示" class="headerlink" title="4.3 增加标题和使用 \t 显示"></a>4.3 增加标题和使用 <code>\t</code> 显示</h3><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">def</span> <span class="title function_">show_all</span>():</span><br><span class="line">    <span class="string">&quot;&quot;&quot;显示全部</span></span><br><span class="line"><span class="string">    &quot;&quot;&quot;</span></span><br><span class="line">    <span class="built_in">print</span>(<span class="string">&quot;-&quot;</span> * <span class="number">50</span>)</span><br><span class="line">    <span class="built_in">print</span>(<span class="string">&quot;功能：显示全部&quot;</span>)</span><br><span class="line"></span><br><span class="line">    <span class="comment"># 打印表头</span></span><br><span class="line">    <span class="keyword">for</span> name <span class="keyword">in</span> [<span class="string">&quot;姓名&quot;</span>, <span class="string">&quot;电话&quot;</span>, <span class="string">&quot;QQ&quot;</span>, <span class="string">&quot;邮箱&quot;</span>]:</span><br><span class="line">        <span class="built_in">print</span>(name, end=<span class="string">&quot;\t\t&quot;</span>)</span><br><span class="line"></span><br><span class="line">    <span class="built_in">print</span>(<span class="string">&quot;&quot;</span>)</span><br><span class="line"></span><br><span class="line">    <span class="comment"># 打印分隔线</span></span><br><span class="line">    <span class="built_in">print</span>(<span class="string">&quot;=&quot;</span> * <span class="number">50</span>)</span><br><span class="line"></span><br><span class="line">    <span class="keyword">for</span> card_dict <span class="keyword">in</span> card_list:</span><br><span class="line"></span><br><span class="line">        <span class="built_in">print</span>(<span class="string">&quot;%s\t\t%s\t\t%s\t\t%s&quot;</span> % (card_dict[<span class="string">&quot;name&quot;</span>],</span><br><span class="line">                                        card_dict[<span class="string">&quot;phone&quot;</span>],</span><br><span class="line">                                        card_dict[<span class="string">&quot;qq&quot;</span>],</span><br><span class="line">                                        card_dict[<span class="string">&quot;email&quot;</span>]))</span><br></pre></td></tr></table></figure>

<h3 id="4-4-增加没有名片记录判断"><a href="#4-4-增加没有名片记录判断" class="headerlink" title="4.4 增加没有名片记录判断"></a>4.4 增加没有名片记录判断</h3><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">def</span> <span class="title function_">show_all</span>():</span><br><span class="line">    <span class="string">&quot;&quot;&quot;显示全部</span></span><br><span class="line"><span class="string">    &quot;&quot;&quot;</span></span><br><span class="line">    <span class="built_in">print</span>(<span class="string">&quot;-&quot;</span> * <span class="number">50</span>)</span><br><span class="line">    <span class="built_in">print</span>(<span class="string">&quot;功能：显示全部&quot;</span>)</span><br><span class="line"></span><br><span class="line">    <span class="comment"># 1. 判断是否有名片记录</span></span><br><span class="line">    <span class="keyword">if</span> <span class="built_in">len</span>(card_list) == <span class="number">0</span>:</span><br><span class="line">        <span class="built_in">print</span>(<span class="string">&quot;提示：没有任何名片记录&quot;</span>)</span><br><span class="line"></span><br><span class="line">        <span class="keyword">return</span></span><br><span class="line"></span><br></pre></td></tr></table></figure>

<p><strong>注意</strong></p>
<ul>
<li><p>在函数中使用 <code>return</code> 表示返回</p>
</li>
<li><p>如果在 <code>return</code> 后没有跟任何内容，只是表示该函数执行到此就不再执行后续的代码</p>
</li>
<li><pre><code># 如果 return 后面 没有任何的内容，表示会返回到调用函数的位置并不会返回任何的结果
# return 返回到调用函数的代码，去执行调用函数下方的代码
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br></pre></td><td class="code"><pre><span class="line"></span><br><span class="line">## 05. 查询名片</span><br><span class="line"></span><br><span class="line">### 5.1 功能分析</span><br><span class="line"></span><br><span class="line">1. 提示用户要搜索的姓名</span><br><span class="line">2. 根据用户输入的姓名遍历列表</span><br><span class="line">3. 搜索到指定的名片后，再执行后续的操作</span><br><span class="line"></span><br><span class="line">### 5.2 代码实现</span><br><span class="line"></span><br><span class="line">* 查询功能实现</span><br><span class="line"></span><br><span class="line">```python</span><br><span class="line">def search_card():</span><br><span class="line"></span><br><span class="line">    &quot;&quot;&quot;搜索名片</span><br><span class="line">    &quot;&quot;&quot;</span><br><span class="line">    print(&quot;-&quot; * 50)</span><br><span class="line">    print(&quot;功能：搜索名片&quot;)</span><br><span class="line"></span><br><span class="line">    # 1. 提示要搜索的姓名</span><br><span class="line">    find_name = input(&quot;请输入要搜索的姓名：&quot;)</span><br><span class="line"></span><br><span class="line">    # 2. 遍历字典</span><br><span class="line">    for card_dict in card_list:</span><br><span class="line"></span><br><span class="line">        if card_dict[&quot;name&quot;] == find_name:</span><br><span class="line"></span><br><span class="line">            print(&quot;姓名\t\t\t电话\t\t\tQQ\t\t\t邮箱&quot;)</span><br><span class="line">            print(&quot;-&quot; * 40)</span><br><span class="line">            </span><br><span class="line">            print(&quot;%s\t\t\t%s\t\t\t%s\t\t\t%s&quot; % (</span><br><span class="line">                card_dict[&quot;name&quot;],</span><br><span class="line">                card_dict[&quot;phone&quot;],</span><br><span class="line">                card_dict[&quot;qq&quot;],</span><br><span class="line">                card_dict[&quot;email&quot;]))</span><br><span class="line"></span><br><span class="line">            print(&quot;-&quot; * 40)</span><br><span class="line">            </span><br><span class="line">            # TODO(小明) 针对找到的字典进行后续操作：修改/删除</span><br><span class="line"></span><br><span class="line">            break</span><br><span class="line">    else:</span><br><span class="line">        print(&quot;没有找到 %s&quot; % find_name)</span><br><span class="line"></span><br></pre></td></tr></table></figure>
</code></pre>
</li>
<li><p>增加名片操作函数：<strong>修改</strong>&#x2F;<strong>删除</strong>&#x2F;<strong>返回主菜单</strong></p>
</li>
</ul>
<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">def</span> <span class="title function_">deal_card</span>(<span class="params">find_dict</span>):</span><br><span class="line"></span><br><span class="line">    <span class="string">&quot;&quot;&quot;操作搜索到的名片字典</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string">    :param find_dict:找到的名片字典</span></span><br><span class="line"><span class="string">    &quot;&quot;&quot;</span></span><br><span class="line">    <span class="built_in">print</span>(find_dict)</span><br><span class="line"></span><br><span class="line">    action_str = <span class="built_in">input</span>(<span class="string">&quot;请选择要执行的操作 &quot;</span></span><br><span class="line">                       <span class="string">&quot;[1] 修改 [2] 删除 [0] 返回上级菜单&quot;</span>)</span><br><span class="line"></span><br><span class="line">    <span class="keyword">if</span> action == <span class="string">&quot;1&quot;</span>:</span><br><span class="line">        <span class="built_in">print</span>(<span class="string">&quot;修改&quot;</span>)</span><br><span class="line">    <span class="keyword">elif</span> action == <span class="string">&quot;2&quot;</span>:</span><br><span class="line">        <span class="built_in">print</span>(<span class="string">&quot;删除&quot;</span>)</span><br><span class="line"></span><br></pre></td></tr></table></figure>

<h2 id="06-修改和删除"><a href="#06-修改和删除" class="headerlink" title="06. 修改和删除"></a>06. 修改和删除</h2><h3 id="6-1-查询成功后删除名片"><a href="#6-1-查询成功后删除名片" class="headerlink" title="6.1 查询成功后删除名片"></a>6.1 查询成功后删除名片</h3><ul>
<li>由于找到的字典记录已经在列表中保存</li>
<li>要删除名片记录，只需要把列表中对应的字典删除即可</li>
</ul>
<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">elif</span> action == <span class="string">&quot;2&quot;</span>:</span><br><span class="line">    card_list.remove(find_dict)</span><br><span class="line"></span><br><span class="line">    <span class="built_in">print</span>(<span class="string">&quot;删除成功&quot;</span>)</span><br></pre></td></tr></table></figure>

<h3 id="6-2-修改名片"><a href="#6-2-修改名片" class="headerlink" title="6.2 修改名片"></a>6.2 修改名片</h3><ul>
<li>由于找到的字典记录已经在列表中保存</li>
<li>要修改名片记录，只需要把列表中对应的字典中每一个键值对的数据修改即可</li>
</ul>
<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">if</span> action == <span class="string">&quot;1&quot;</span>:</span><br><span class="line"></span><br><span class="line">    find_dict[<span class="string">&quot;name&quot;</span>] = <span class="built_in">input</span>(<span class="string">&quot;请输入姓名：&quot;</span>)</span><br><span class="line">    find_dict[<span class="string">&quot;phone&quot;</span>] = <span class="built_in">input</span>(<span class="string">&quot;请输入电话：&quot;</span>)</span><br><span class="line">    find_dict[<span class="string">&quot;qq&quot;</span>] = <span class="built_in">input</span>(<span class="string">&quot;请输入QQ：&quot;</span>)</span><br><span class="line">    find_dict[<span class="string">&quot;email&quot;</span>] = <span class="built_in">input</span>(<span class="string">&quot;请输入邮件：&quot;</span>)</span><br><span class="line"></span><br><span class="line">    <span class="built_in">print</span>(<span class="string">&quot;%s 的名片修改成功&quot;</span> % find_dict[<span class="string">&quot;name&quot;</span>])</span><br><span class="line"></span><br></pre></td></tr></table></figure>

<h4 id="修改名片细化"><a href="#修改名片细化" class="headerlink" title="修改名片细化"></a>修改名片细化</h4><ul>
<li><strong>如果用户在使用时，某些名片内容并不想修改</strong>，应该如何做呢？—— 既然系统提供的 <code>input</code> 函数不能满足需求，那么就新定义一个函数 <code>input_card_info</code> 对系统的 <code>input</code> 函数进行扩展</li>
</ul>
<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">def</span> <span class="title function_">input_card_info</span>(<span class="params">dict_value, tip_message</span>):</span><br><span class="line"></span><br><span class="line">    <span class="string">&quot;&quot;&quot;输入名片信息</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string">    :param dict_value: 字典原有值</span></span><br><span class="line"><span class="string">    :param tip_message: 输入提示信息</span></span><br><span class="line"><span class="string">    :return: 如果输入，返回输入内容，否则返回字典原有值</span></span><br><span class="line"><span class="string">    &quot;&quot;&quot;</span></span><br><span class="line">    <span class="comment"># 1. 提示用户输入内容</span></span><br><span class="line">    result_str = <span class="built_in">input</span>(tip_message)</span><br><span class="line"></span><br><span class="line">    <span class="comment"># 2. 针对用户的输入进行判断，如果用户输入了内容，直接返回结果</span></span><br><span class="line">    <span class="keyword">if</span> <span class="built_in">len</span>(result_str) &gt; <span class="number">0</span>:</span><br><span class="line"></span><br><span class="line">        <span class="keyword">return</span> result_str</span><br><span class="line">    <span class="comment"># 3. 如果用户没有输入内容，返回 `字典中原有的值`</span></span><br><span class="line">    <span class="keyword">else</span>:</span><br><span class="line"></span><br><span class="line">        <span class="keyword">return</span> dict_value</span><br><span class="line"></span><br></pre></td></tr></table></figure>

<h2 id="07-LINUX-上的-Shebang-符号"><a href="#07-LINUX-上的-Shebang-符号" class="headerlink" title="07. LINUX 上的 Shebang 符号(#!)"></a>07. LINUX 上的 <code>Shebang</code> 符号(<code>#!</code>)</h2><ul>
<li><code>#!</code>这个符号叫做 <code>Shebang</code> 或者 <code>Sha-bang</code></li>
<li><code>Shebang</code> 通常在 <code>Unix</code> 系统脚本的中 <strong>第一行开头</strong> 使用</li>
<li>指明 <strong>执行这个脚本文件</strong> 的 <strong>解释程序</strong></li>
</ul>
<h3 id="使用-Shebang-的步骤"><a href="#使用-Shebang-的步骤" class="headerlink" title="使用 Shebang 的步骤"></a>使用 Shebang 的步骤</h3><ul>
<li><ol>
<li>使用 <code>which</code> 查询 <code>python3</code> 解释器所在路径</li>
</ol>
</li>
</ul>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ <span class="built_in">which</span> python3</span><br></pre></td></tr></table></figure>

<ul>
<li><ol start="2">
<li>修改要运行的 <strong>主 python 文件</strong>，在第一行增加以下内容</li>
</ol>
</li>
</ul>
<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">#! /usr/bin/python3</span></span><br></pre></td></tr></table></figure>

<ul>
<li><ol start="3">
<li>修改 <strong>主 python 文件</strong> 的文件权限，增加执行权限</li>
</ol>
</li>
</ul>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ <span class="built_in">chmod</span> +x cards_main.py</span><br></pre></td></tr></table></figure>

<ul>
<li><ol start="4">
<li>在需要时执行程序即可</li>
</ol>
</li>
</ul>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">./cards_main.py</span><br></pre></td></tr></table></figure>




            <!--[if lt IE 9]><script>document.createElement('audio');</script><![endif]-->
            <audio id="audio" loop="1" preload="auto" controls="controls" data-autoplay="false">
                <source type="audio/mpeg" src="">
            </audio>
            
                <ul id="audio-list" style="display:none">
                    
                        
                            <li title="0" data-url="http://link.hhtjim.com/163/425570952.mp3"></li>
                        
                    
                        
                            <li title="1" data-url="http://link.hhtjim.com/163/425570952.mp3"></li>
                        
                    
                </ul>
            
        </div>
        
        
    <div id="gitalk-container" class="comment link"
		data-enable="false"
        data-ae="false"
        data-ci=""
        data-cs=""
        data-r=""
        data-o=""
        data-a=""
        data-d="false"
    >查看评论</div>


    </div>
    
</div>


    </div>
</div>
</body>


<script src="//lib.baomitu.com/jquery/1.8.3/jquery.min.js"></script>
<script src="/js/plugin.js"></script>
<script src="/js/typed.js"></script>
<script src="/js/diaspora.js"></script>


<link rel="stylesheet" href="/photoswipe/photoswipe.css">
<link rel="stylesheet" href="/photoswipe/default-skin/default-skin.css">


<script src="/photoswipe/photoswipe.min.js"></script>
<script src="/photoswipe/photoswipe-ui-default.min.js"></script>


<!-- Root element of PhotoSwipe. Must have class pswp. -->
<div class="pswp" tabindex="-1" role="dialog" aria-hidden="true">
    <!-- Background of PhotoSwipe. 
         It's a separate element as animating opacity is faster than rgba(). -->
    <div class="pswp__bg"></div>
    <!-- Slides wrapper with overflow:hidden. -->
    <div class="pswp__scroll-wrap">
        <!-- Container that holds slides. 
            PhotoSwipe keeps only 3 of them in the DOM to save memory.
            Don't modify these 3 pswp__item elements, data is added later on. -->
        <div class="pswp__container">
            <div class="pswp__item"></div>
            <div class="pswp__item"></div>
            <div class="pswp__item"></div>
        </div>
        <!-- Default (PhotoSwipeUI_Default) interface on top of sliding area. Can be changed. -->
        <div class="pswp__ui pswp__ui--hidden">
            <div class="pswp__top-bar">
                <!--  Controls are self-explanatory. Order can be changed. -->
                <div class="pswp__counter"></div>
                <button class="pswp__button pswp__button--close" title="Close (Esc)"></button>
                <button class="pswp__button pswp__button--share" title="Share"></button>
                <button class="pswp__button pswp__button--fs" title="Toggle fullscreen"></button>
                <button class="pswp__button pswp__button--zoom" title="Zoom in/out"></button>
                <!-- Preloader demo http://codepen.io/dimsemenov/pen/yyBWoR -->
                <!-- element will get class pswp__preloader--active when preloader is running -->
                <div class="pswp__preloader">
                    <div class="pswp__preloader__icn">
                      <div class="pswp__preloader__cut">
                        <div class="pswp__preloader__donut"></div>
                      </div>
                    </div>
                </div>
            </div>
            <div class="pswp__share-modal pswp__share-modal--hidden pswp__single-tap">
                <div class="pswp__share-tooltip"></div> 
            </div>
            <button class="pswp__button pswp__button--arrow--left" title="Previous (arrow left)">
            </button>
            <button class="pswp__button pswp__button--arrow--right" title="Next (arrow right)">
            </button>
            <div class="pswp__caption">
                <div class="pswp__caption__center"></div>
            </div>
        </div>
    </div>
</div>






</html>
